#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Event.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class TimeExpression;

/// <summary>
/// TimeEvent
/// A TimeEvent is an Event that occurs at a specific point in time.
/// </summary>
class UMLMODEL_EXPORT TimeEvent : public Event {

public: // Constructors and destructors
    explicit TimeEvent(const QString& umlType="uml::TimeEvent");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// isRelative getter
    /// Specifies whether the TimeEvent is specified as an absolute or relative time.
    /// </summary>
    bool isRelative() const;

    /// <summary>
    /// isRelative setter
    /// Specifies whether the TimeEvent is specified as an absolute or relative time.
    /// </summary>
    void setIsRelative(bool value);

    /// <summary>
    /// when getter
    /// Specifies the time of the TimeEvent.
    /// </summary>
    shared_ptr<TimeExpression> when() const;

    /// <summary>
    /// when setter
    /// Specifies the time of the TimeEvent.
    /// </summary>
    void setWhen(shared_ptr<TimeExpression> value);

private: // Fields
    /// <summary>
    /// isRelative
    /// Specifies whether the TimeEvent is specified as an absolute or relative time.
    /// </summary>
    const static bool isRelative_default_;
    bool isRelative_= isRelative_default_;

    /// <summary>
    /// when
    /// Specifies the time of the TimeEvent.
    /// </summary>
    shared_ptr<TimeExpression> when_;

};

} // namespace uml
